// /common/http.api.js

import request from '@/common/request/request.js'
import {
  stringFormat,
  toQueryString
} from '@/common/utils/util.js'

const GET = 'GET'
const POST = 'POST'
const PUT = 'PUT'
const DELETE = 'DELETE'

// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
// let wxappLoginUrl = '/Wechatapplets/userInfo';

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
const install = (Vue, vm) => {
  // 此处没有使用传入的params参数

  let addLog = (params = {}) => request(params, "/scl/log/add", POST).then(res => res)

  let getCategoryList = (params = {}) => request(params, "/scl/categoryList", GET).then(res => res)

  let getEshopConsultGoodsList = (params = {}) => request(params, "/virtualGoods/givePriceList", GET).then(res => res)

  let orderPay = (params = {}) => request(params, "/order/orderPay", POST).then(res => res)

  let getCloseMoreSclUrl = (params = {}) => request(params, "/scl/getCloseMoreSclUrl", GET).then(res => res)

  let getCheckUpSclTextList = (params = {}) => request(params, "/scl/examination/writerDetail", GET).then(res => res)

  let updateCheckUpSclText = (params = {}) => request(params, "/scl/examination/editWriter", GET).then(res => res)

  let getCheckUpList = (params = {}) => request(params, "/scl/examination/list", GET).then(res => res)

  let getSclInfo = (params = {}) => request(params, "/scl/get_scl_info", GET).then(res => res)

  let getSclList = (params = {}) => request(params, "/scl/get_more_scl_list", GET).then(res => res)

  let getCheckUpSclDetail = (params = {}) => request(params, "/scl/examination/detail", GET).then(res => res)

  let getQrcodeUrl = (params = {}) => request(params, "/clientTask/getQrCodeUrl", GET).then(res => res)

  let getCateSclRandom = (params = {}) => request(params, "/scl/categoryListRandom", GET).then(res => res)

  let getTransactionSclList = (params = {}) => request(params, "/customer/transaction/getTransactionSclList", GET).then(res => res)


  let getCheckupSclTotalReport = (params = {}) => request(params, "/scl/examination/totalReportDetail", GET).then(res => res)

  let giveScl = (params = {}) => request(params, "/scl/giveScl", POST).then(res => res)

  let sclOneGoods = (params = {}) => request(params, "/virtualGoods/sclOneGoods", POST).then(res => res)

  let updateUserInfo = (params = {}) => request(params, "/usermini/user/updateUserInfo", POST).then(res => res)

  let userWebAnswer = (params = {}) => request(params, "/scl/userWebAnswer", POST).then(res => res)

  let getSclDictCode = (params = {}) => request(params, "/scl/getSclDictCode", GET).then(res => res)

  let getNewReportId = (params = {}) => request(params, "/scl/getNewReportId", GET).then(res => res)

  let getReportInfo = (data = {}) => request(data, "/scl/resultShow" + toQueryString(data), POST).then(res => res)

  let selectByCode = (params = {}) => request(params, "/virtualGoods/selectByCode", GET).then(res => res)

  let getUserActCouponList = (params = {}) => request(params, "/discount/getUserDiscountTakeEffect", GET).then(res => res)

  let getPrePromotionSclList = (params = {}) => request(params, "/scl/boutiqueSclList", GET).then(res => res)

  let getUserSclAns = (params = {}) => request(params, "/scl/userSclAns", GET).then(res => res)

  let getBySclReport = (params = {}) => request(params, "/scl/getBySclReport", GET).then(res => res)

  let addUserDiscountCode = (params = {}) => request(params, "/discount/addUserDiscountCode", GET).then(res => res)

  let getExaminationResultShow = (params = {}) => request(params, "/scl/examination/depression/examinationResultShow", GET).then(res => res)

  let getDepressionList = (params = {}) => request(params, "/scl/examination/depression/list", GET).then(res => res)

  let getDictDataByCode = (params = {}) => request(params, "/dictData/get_dict_data_by_code", GET).then(res => res)

  let isPaySclExamination = (params = {}) => request(params, "/scl/examination/isPaySclExamination", GET).then(res => res)

  let getWriterDetail = (params = {}) => request(params, "/scl/examination/depression/writerDetail", GET).then(res => res)

  let updateDepressionDialogIndex = (params = {}) => request(params, "/scl/examination/depression/editWriter", GET).then(res => res)

  let getDepressionReportDetail = (params = {}) => request(params, "/scl/examination/depression/reportDetail", GET).then(res => res)

  let getWxPayToken = (params = {}) => request(params, "/storeUserMiniAppOrder/wxPayToken", POST).then(res => res)


  let getSexualityQstList = (params = {}) => request(params, "/scl/examination/depression/sclSexualOrientationTopic", GET).then(res => res)

  let getSclListByGroup = (params = {}) => request(params, "/scl/examination/depression/list", GET).then(res => res)

  let sclSexualOrientationLabel = (params = {}) => request(params, "/scl/examination/depression/sclSexualOrientationLabel", GET).then(res => res)


  // 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
  vm.$u.api = {
    addLog,
    getCategoryList,
    getEshopConsultGoodsList,
    orderPay,
    sclOneGoods,
    getCloseMoreSclUrl,
    getCheckUpSclTextList,
    updateCheckUpSclText,
    getCheckUpList,
    getSclInfo,
    getCheckUpSclDetail,
    getQrcodeUrl,
    getUserSclAns,
    getBySclReport,
    getCateSclRandom,
    addUserDiscountCode,
    getTransactionSclList,
    getCheckupSclTotalReport,
    giveScl,
    updateUserInfo,
    getSclDictCode,
    getNewReportId,
    getReportInfo,
    selectByCode,
    getUserActCouponList,
    getSclList,
    getPrePromotionSclList,
    getExaminationResultShow,
    getDepressionList,
    getDictDataByCode,
    isPaySclExamination,
    userWebAnswer,
    getWriterDetail,
    updateDepressionDialogIndex,
    getDepressionReportDetail,
    getWxPayToken,
    getSexualityQstList,
    getSclListByGroup,
    sclSexualOrientationLabel
  }
}

export default {
  install
}
